package practice1_100;

import java.util.HashMap;

public class Practice1711 {
    public int countPairs(int[] deliciousness) {
        int count=0;
        HashMap<Integer,Boolean> map=new HashMap<>();
        map.put(0,false);
        for(int i=0;i<deliciousness.length-1;i++){
            for(int j=i+1;j<deliciousness.length;j++){
                if(isTowMi(deliciousness[i],deliciousness[j],map)) count=(count+1)%1000000007;
            }
        }
        return count;
    }

    public boolean isTowMi(int i,int j,HashMap<Integer,Boolean> map){
        int count=i+j;
        if(count==1)return false;
        while(count!=1){
            if(map.get(count)!=null)return map.get(count);
            if(count%2==1)return false;
            count/=2;
        }
        map.put(count,true);
        return true;
    }

    public static void main(String[] args) {
        int res=new Practice1711().countPairs(new int[]{1,3,5,7,9});
        System.out.println(res);
    }
}
